home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / arch / arm / plat-mxc / include / mach / mxc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-09  |  9.2 KB  |  409 lines

  1. /*
  2.  * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  3.  * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU General Public License
  7.  * as published by the Free Software Foundation; either version 2
  8.  * of the License, or (at your option) any later version.
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17.  * MA 02110-1301, USA.
  18.  */
  19.  
  20. #ifndef __ASM_ARCH_MXC_H__
  21. #define __ASM_ARCH_MXC_H__
  22.  
  23. #ifndef __ASM_ARCH_MXC_HARDWARE_H__
  24. #error "Do not include directly."
  25. #endif
  26.  
  27. #ifndef __ASSEMBLY__
  28. #include <linux/types.h>
  29.  
  30. /*!
  31.  * @ingroup MSL_MX27 MSL_MX31 MSL_MXC91321  MSL_MX37
  32.  */
  33. /*!
  34.  * gpio port structure
  35.  */
  36. struct mxc_gpio_port {
  37.     u32 num;        /*!< gpio port number */
  38.     u32 base;        /*!< gpio port base VA */
  39. #ifdef MXC_GPIO_SPLIT_IRQ_2
  40.     u16 irq_0_15, irq_16_31;
  41. #else
  42.     u16 irq;        /*!< irq number to the core */
  43. #endif
  44.     u16 virtual_irq_start;    /*!< virtual irq start number */
  45. };
  46. /*!
  47.  * This structure is used to define the One wire platform data.
  48.  * It includes search rom accelerator.
  49.  */
  50.  
  51. struct mxc_w1_config {
  52.     int search_rom_accelerator;
  53. };
  54. /*!
  55.  * This structure is used to define the SPI master controller's platform
  56.  * data. It includes the SPI  bus number and the maximum number of
  57.  * slaves/chips it supports.
  58.  */
  59. struct mxc_spi_master {
  60.     /*!
  61.      * SPI Master's bus number.
  62.      */
  63.     unsigned int bus_num;
  64.     /*!
  65.      * SPI Master's maximum number of chip selects.
  66.      */
  67.     unsigned int maxchipselect;
  68.     /*!
  69.      * CSPI Hardware Version.
  70.      */
  71.     unsigned int spi_version;
  72. };
  73.  
  74. struct mxc_ipu_config {
  75.     int rev;
  76.     struct clk *di_clk[2];
  77. };
  78.  
  79. struct mxc_ir_platform_data {
  80.     int uart_ir_mux;
  81.     int ir_rx_invert;
  82.     int ir_tx_invert;
  83.     struct clk *uart_clk;
  84. };
  85.  
  86. struct mxc_i2c_platform_data {
  87.     u32 i2c_clk;
  88. };
  89.  
  90. /*
  91.  * This struct is to define the number of SSIs on a platform,
  92.  * DAM source port config, DAM external port config,
  93.  * regulator names, and other stuff audio needs.
  94.  */
  95. struct mxc_audio_platform_data {
  96.     int ssi_num;
  97.     int src_port;
  98.     int ext_port;
  99.  
  100.     int intr_id_hp;
  101.     int ext_ram;
  102.     struct clk *ssi_clk[2];
  103.     char *regulator1;
  104.     char *regulator2;
  105.  
  106.     int hp_irq;
  107.     int (*hp_status) (void);
  108.  
  109.     char *vddio_reg;
  110.     char *vdda_reg;
  111.     char *vddd_reg;
  112.     int vddio;        /* voltage of VDDIO (uv) */
  113.     int vdda;        /* voltage of vdda (uv) */
  114.     int vddd;        /* voltage of vddd (uv), 0 if not connected */
  115.     int sysclk;
  116.  
  117.     int (*init) (void);    /* board specific init */
  118.     int (*amp_enable) (int enable);
  119.     int (*finit) (void);    /* board specific finit */
  120.     void *priv;        /* used by board specific functions */
  121. };
  122.  
  123. struct mxc_spdif_platform_data {
  124.     int spdif_tx;
  125.     int spdif_rx;
  126.     int spdif_clk_44100;
  127.     int spdif_clk_48000;
  128.     int spdif_clkid;
  129.     struct clk *spdif_clk;
  130.     struct clk *spdif_core_clk;
  131. };
  132.  
  133. struct mxc_asrc_platform_data {
  134.     struct clk *asrc_core_clk;
  135.     struct clk *asrc_audio_clk;
  136.     unsigned int channel_bits;
  137. };
  138.  
  139. struct mxc_bt_platform_data {
  140.     char *bt_vdd;
  141.     char *bt_vdd_parent;
  142.     char *bt_vusb;
  143.     char *bt_vusb_parent;
  144.     void (*bt_reset) (void);
  145. };
  146.  
  147. struct mxc_lightsensor_platform_data {
  148.     char *vdd_reg;
  149.     int rext;
  150. };
  151.  
  152. struct mxc_fb_platform_data {
  153.     struct fb_videomode *mode;
  154.     u32 interface_pix_fmt;
  155. };
  156.  
  157. struct mxc_lcd_platform_data {
  158.     char *io_reg;
  159.     char *core_reg;
  160.     char *analog_reg;
  161.     void (*reset) (void);
  162. };
  163.  
  164. struct mxc_dvfs_platform_data {
  165.     /** Supply voltage regulator name string */
  166.     char *reg_id;
  167.     /* CPU clock name string */
  168.     char *clk1_id;
  169.     /* DVFS clock name string */
  170.     char *clk2_id;
  171.     /* GPC control reg address */
  172.     unsigned int gpc_cntr_reg_addr;
  173.     /* GPC voltage counter reg address */
  174.     unsigned int gpc_vcr_reg_addr;
  175.     /* DVFS threshold reg address */
  176.     unsigned int dvfs_thrs_reg_addr;
  177.     /* DVFS counters reg address */
  178.     unsigned int dvfs_coun_reg_addr;
  179.     /* DVFS EMAC reg address */
  180.     unsigned int dvfs_emac_reg_addr;
  181.     /* DVFS control reg address */
  182.     unsigned int dvfs_cntr_reg_addr;
  183.     /* DIV3CK mask */
  184.     u32 div3ck_mask;
  185.     /* DIV3CK offset */
  186.     int div3ck_offset;
  187.     /* DIV3CK value */
  188.     int div3ck_val;
  189.     /* EMAC value */
  190.     int emac_val;
  191.     /* Frequency increase threshold. Increase frequency change request
  192.        will be sent if DVFS counter value will be more than this value */
  193.     int upthr_val;
  194.     /* Frequency decrease threshold. Decrease frequency change request
  195.        will be sent if DVFS counter value will be less than this value */
  196.     int dnthr_val;
  197.     /* Panic threshold. Panic frequency change request
  198.        will be sent if DVFS counter value will be more than this value */
  199.     int pncthr_val;
  200.     /* The amount of times the up threshold should be exceeded
  201.        before DVFS will trigger frequency increase request */
  202.     int upcnt_val;
  203.     /* The amount of times the down threshold should be exceeded
  204.        before DVFS will trigger frequency decrease request */
  205.     int dncnt_val;
  206.     /* Delay time in us */
  207.     int delay_time;
  208.     /* Number of woking points supported */
  209.     int num_wp;
  210. };
  211.  
  212. struct mxc_tsc_platform_data {
  213.     char *vdd_reg;
  214.     int penup_threshold;
  215.     void (*active) (void);
  216.     void (*inactive) (void);
  217. };
  218.  
  219. struct mxc_tvout_platform_data {
  220.     char *io_reg;
  221.     char *core_reg;
  222.     char *analog_reg;
  223.     u32 detect_line;
  224. };
  225.  
  226. struct mxc_tvin_platform_data {
  227.     char *dvddio_reg;
  228.     char *dvdd_reg;
  229.     char *avdd_reg;
  230.     char *pvdd_reg;
  231.     void (*pwdn) (int pwdn);
  232.     void (*reset) (void);
  233. };
  234.  
  235. /*! Platform data for the IDE drive structure. */
  236. struct mxc_ide_platform_data {
  237.     char *power_drive;    /*!< The power pointer */
  238.     char *power_io;        /*!< The power pointer */
  239. };
  240.  
  241. struct mxc_camera_platform_data {
  242.     char *core_regulator;
  243.     char *io_regulator;
  244.     char *analog_regulator;
  245.     char *gpo_regulator;
  246.     u32 mclk;
  247.     u32 csi;
  248. };
  249.  
  250. /*gpo1-3 is in fixed state by hardware design,
  251.  * only deal with reset pin and clock_enable pin
  252.  * only poll mode can be used to control the chip,
  253.  * interrupt mode is not supported by 3ds*/
  254. struct mxc_fm_platform_data {
  255.     char *reg_vio;
  256.     char *reg_vdd;
  257.     void (*gpio_get) (void);
  258.     void (*gpio_put) (void);
  259.     void (*reset) (void);
  260.     void (*clock_ctl) (int flag);
  261.     u8    sksnr; /*0,disable;1,most stop;0xf,fewest stop*/
  262.     u8    skcnt; /*0,disable;1,most stop;0xf,fewest stop*/
  263.     /*
  264.     00 = 87.5-108 MHz (USA,Europe) (Default).
  265.     01 = 76-108 MHz (Japan wide band).
  266.     10 = 76-90 MHz (Japan).
  267.     11 = Reserved.
  268.     */
  269.     u8    band;
  270.     /*
  271.     00 = 200 kHz (USA, Australia) (default).
  272.     01 = 100 kHz (Europe, Japan).
  273.     10 = 50 kHz.
  274.     */
  275.     u8    space;
  276.     u8    seekth;
  277. };
  278.  
  279. struct mxc_mma7450_platform_data {
  280.     char *reg_dvdd_io;
  281.     char *reg_avdd;
  282.     void (*gpio_pin_get) (void);
  283.     void (*gpio_pin_put) (void);
  284.     int int1;
  285.     int int2;
  286. };
  287.  
  288. struct mxc_keyp_platform_data {
  289.     u16 *matrix;
  290.     void (*active) (void);
  291.     void (*inactive) (void);
  292.     char *vdd_reg;
  293. };
  294.  
  295. struct mxc_unifi_platform_data {
  296.     void (*hardreset) (void);
  297.     void (*enable) (int en);
  298.     /* power parameters */
  299.     char *reg_gpo1;
  300.     char *reg_gpo2;
  301.     char *reg_1v5_ana_bb;
  302.     char *reg_vdd_vpa;
  303.     char *reg_1v5_dd;
  304.  
  305.     int host_id;
  306.  
  307.     void *priv;
  308. };
  309.  
  310. struct mxc_gps_platform_data {
  311.     char *core_reg;
  312.     char *analog_reg;
  313. };
  314.  
  315. struct mxc_mlb_platform_data {
  316.     u32 buf_address;
  317.     u32 phy_address;
  318.     char *reg_nvcc;
  319.     char *mlb_clk;
  320. };
  321.  
  322. struct flexcan_platform_data {
  323.     char *core_reg;
  324.     char *io_reg;
  325.     void (*xcvr_enable) (int id, int en);
  326.     void (*active) (int id);
  327.     void (*inactive) (int id);
  328. };
  329.  
  330. struct mxc_srtc_platform_data {
  331.     u32 srtc_sec_mode_addr;
  332. };
  333.  
  334. struct tve_platform_data {
  335.     char *dac_reg;
  336.     char *dig_reg;
  337. };
  338.  
  339. extern void mxc_wd_reset(void);
  340. unsigned long board_get_ckih_rate(void);
  341.  
  342. int mxc_snoop_set_config(u32 num, unsigned long base, int size);
  343. int mxc_snoop_get_status(u32 num, u32 * statl, u32 * stath);
  344.  
  345. struct platform_device;
  346. void mxc_pg_enable(struct platform_device *pdev);
  347. void mxc_pg_disable(struct platform_device *pdev);
  348.  
  349. struct mxc_unifi_platform_data *get_unifi_plat_data(void);
  350.  
  351. #endif                /* __ASSEMBLY__ */
  352.  
  353. #define MUX_IO_P        29
  354. #define MUX_IO_I        24
  355. #define IOMUX_TO_GPIO(pin)     ((((unsigned int)pin >> MUX_IO_P) * GPIO_NUM_PIN) + ((pin >> MUX_IO_I) & ((1 << (MUX_IO_P - MUX_IO_I)) -1)))
  356. #define IOMUX_TO_IRQ(pin)    (MXC_GPIO_INT_BASE + IOMUX_TO_GPIO(pin))
  357. #define GPIO_TO_PORT(n)        (n / GPIO_NUM_PIN)
  358. #define GPIO_TO_INDEX(n)    (n % GPIO_NUM_PIN)
  359.  
  360. /* DMA driver defines */
  361. #define MXC_IDE_DMA_WATERMARK    32    /* DMA watermark level in bytes */
  362. #define MXC_IDE_DMA_BD_NR    (512/3/4)    /* Number of BDs per channel */
  363.  
  364. #ifndef IS_MEM_DEVICE_NONSHARED
  365. /* all peripherals on MXC so far are below 0x80000000 but leave L2CC alone */
  366. #define IS_MEM_DEVICE_NONSHARED(x)  ((x) < 0x80000000 && (x) != L2CC_BASE_ADDR)
  367. #endif
  368. /*!
  369.  * DPTC GP and LP ID
  370.  */
  371. #define DPTC_GP_ID 0
  372. #define DPTC_LP_ID 1
  373.  
  374. #ifndef __ASSEMBLY__
  375. #include <linux/types.h>
  376.  
  377. struct cpu_wp {
  378.     u32 pll_reg;
  379.     u32 pll_rate;
  380.     u32 cpu_rate;
  381.     u32 pdr0_reg;
  382.     u32 pdf;
  383.     u32 mfi;
  384.     u32 mfd;
  385.     u32 mfn;
  386.     u32 cpu_voltage;
  387.     u32 cpu_podf;
  388. };
  389.  
  390. #ifndef CONFIG_ARCH_MX51
  391. struct cpu_wp *get_cpu_wp(int *wp);
  392. #endif
  393.  
  394. enum mxc_cpu_pwr_mode {
  395.     WAIT_CLOCKED,        /* wfi only */
  396.     WAIT_UNCLOCKED,        /* WAIT */
  397.     WAIT_UNCLOCKED_POWER_OFF,    /* WAIT + SRPG */
  398.     STOP_POWER_ON,        /* just STOP */
  399.     STOP_POWER_OFF,        /* STOP + SRPG */
  400. };
  401.  
  402. void mxc_cpu_lp_set(enum mxc_cpu_pwr_mode mode);
  403. int tzic_enable_wake(int is_idle);
  404. void gpio_activate_audio_ports(void);
  405.  
  406. #endif
  407.  
  408. #endif                /*  __ASM_ARCH_MXC_H__ */
  409.